{extend name="base"/}
{block name="resources"}
<link rel="stylesheet" href="ADMIN_CSS/goods_lists.css">
<style>
	.promotion-addon span {
		border-radius: 3px;
		border: 1px solid;
		font-size: 12px;
		line-height: 14px;
		padding: 2px 4px;
		margin-right: 3px;
		margin-top: 3px;
		color: #FFFFFF;
	}
	.layui-table-header .layui-table-cell{
		overflow: inherit;
	}
	.layui-table-box {overflow: inherit;}
	.layui-table-header {overflow: inherit;}
	.layui-table-cell, .layui-table-tool-panel li {overflow: inherit;}
	.info-wrap{
		width: 100%;
	}
	.prices {

		width: 100%;
	}
</style>
{/block}
{block name="main"}
<!--<div class="layui-collapse ns-tips">
	<div class="layui-colla-item">
		<h2 class="layui-colla-title">操作提示</h2>
		<ul class="layui-colla-content layui-show">
			<li>当前显示的是商家发布过的所有商品，当商品处于上架状态时前台显示</li>
			<li>虚拟商品用户购买之后可以通过订单核销进行商品核销处理。</li>
			<li>如果商家的商品操作违规，平台可以操作违规下架，违规下架的商品需要商家编辑审核之后才能重新上架</li>
		</ul>
	</div>
</div>-->

<div class="ns-single-filter-box" style="justify-content:unset;">
	<button class="layui-btn ns-bg-color" onclick="add()">添加商品</button>
</div>


<div class="ns-screen layui-collapse" lay-filter="selection_panel">
	<div class="layui-colla-item">
		<h2 class="layui-colla-title">筛选</h2>
		<form class="layui-colla-content layui-form layui-show">
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">搜索方式：</label>
					<div class="layui-input-inline">
						<select name="search_text_type">
							<option value="goods_name">商品名称</option>
							<option value="site_name">店铺名称</option>
						</select>
					</div>
					<div class="layui-input-inline">
						<input type="text" name="search_text" autocomplete="off" class="layui-input" placeholder="输入商品名称/店铺名称" />
					</div>
				</div>

				<div class="layui-inline">
					<label class="layui-form-label">商品分类：</label>
					<div class="layui-input-inline">
						{include file="goods/category_select" /}
					</div>
				</div>
			</div>

			<!--<div class="layui-form-item">

				<div class="layui-inline">
					<label class="layui-form-label">商品分类：</label>
					<div class="layui-input-inline">
						{include file="goods/category_select" /}
					</div>
				</div>
			</div>-->


			<input type="hidden" name="goods_state" />


			<div class="ns-form-row">
				<button class="layui-btn ns-bg-color" lay-submit id="" lay-filter="search">筛选</button>
				<button type="reset" class="layui-btn layui-btn-primary reset">重置</button>
			</div>
		</form>
	</div>
</div>

<div class="layui-tab ns-table-tab" lay-filter="goods_list_tab">
	<ul class="layui-tab-title">
		<li class="layui-this" lay-id="">全部</li>
		<li lay-id="1" data-type="goods_state">销售中</li>
		<li lay-id="0" data-type="goods_state">仓库中</li>
	</ul>
	<div class="layui-tab-content">
		<table id="goods_list" lay-filter="goods_list"></table>
	</div>
</div>

<!-- 商品信息 -->
<script type="text/html" id="goods_info">
	<div class="ns-table-title">
		<div class="contraction" data-goods-id="{{d.goods_id}}" data-open="0">
			<span>+</span>
		</div>
		<div class="ns-title-pic" id="goods_img_{{d.goods_id}}">
			<img layer-src src="{{ns.img(d.goods_image.split(',')[0], 'small')}}"/>
		</div>
		<div class="ns-title-content">
			<a href="javascript:;" class="ns-multi-line-hiding ns-gn-color" title="{{d.goods_name}}" lay-event="preview">{{d.goods_name}}</a>
			{{# if(d.promotion_addon && d.promotion_addon_list){ }}
			<div class="promotion-addon">
				{{# for(var i=0;i<d.promotion_addon_list.length;i++){ }}
				<a href="{{
				if(inArray('shop_url',d.promotion_addon_list[i]){
					ns.url( d.promotion_addon_list[i].shop_url)
				}else{
					ns.url( d.promotion_addon_list[i].url)
				}
				}}"><span class="ns-bg-color" title="{{d.promotion_addon_list[i].name}}">{{ d.promotion_addon_list[i].short }}</span></a>
				{{# } }}
			</div>
			{{# } }}
			<!--            {{# if(d.is_consume_discount ==1){ }}-->
			<!--            <span class="promotion-addon vips_price" data-goods-id="{{d.goods_id}}" data-open="0">-->
			<!--				<span class="layui-bg-black " title="会员价"><span class="iconfont iconhuiyuan icon"> 会员价</span></span>-->
			<!--			</span>-->

			<!--            {{# } }}-->
		</div>
	</div>
</script>

<!-- 操作 -->
<script type="text/html" id="action">
	<div class="operation-wrap" data-goods-id="{{d.goods_id}}">
		<div class="popup-qrcode-wrap"><img class="popup-qrcode-loadimg" src="__STATIC__/loading/loading.gif" /></div>
		<div class="ns-table-btn">
			{{# if(d.verify_state == 1 && d.goods_state == 1){ }}

			<a class="layui-btn" lay-event="edit">编辑</a>
			<a class="layui-btn" lay-event="delete">删除</a>
			<a class="layui-btn" lay-event="off_goods">下架</a>
			{{# } else if(d.verify_state == 1 && d.goods_state == 0){ }}

			<a class="layui-btn" lay-event="edit">编辑</a>
			<a class="layui-btn" lay-event="delete">删除</a>
			<a class="layui-btn" lay-event="on_goods">上架</a>
			{{# } else if(d.verify_state == 0){ }}
			<a class="layui-btn" lay-event="edit">编辑</a>
			<a class="layui-btn" lay-event="delete">删除</a>
			{{# }else{ }}
			<a class="layui-btn" lay-event="edit">编辑</a>
			<a class="layui-btn" lay-event="delete">删除</a>
			{{# } }}

		</div>
	</div>
</script>

<!-- 批量操作 -->
<script type="text/html" id="toolbarOperation">
<!--	<button class="layui-btn layui-btn-primary" lay-event="verify_on">审核通过</button>-->
	<button class="layui-btn layui-btn-primary" lay-event="on_goods">批量上架</button>
	<button class="layui-btn layui-btn-primary" lay-event="off_goods">批量下架</button>
<!--	<button class="layui-btn layui-btn-primary" lay-event="recommend_way">推荐方式</button>-->
</script>

<!-- 批量操作 -->
<script type="text/html" id="batchOperation">
<!--	<button class="layui-btn layui-btn-primary" lay-event="verify_on">审核通过</button>-->
	<button class="layui-btn layui-btn-primary" lay-event="on_goods">批量上架</button>
	<button class="layui-btn layui-btn-primary" lay-event="off_goods">批量下架</button>
<!--	<button class="layui-btn layui-btn-primary" lay-event="recommend_way">推荐方式</button>-->
</script>

<!-- SKU商品列表 -->
<script type="text/html" id="skuList">
	<tr class="js-sku-list-{{d.index}}" id="sku_img_{{d.index}}">
		<td></td>
		<td colspan="6">
			<ul class="sku-list">
				{{# for(var i=0;i<d.list.length;i++){ }}
				<li>
					<div class="img-wrap">
						<img layer-src src="{{ns.img(d.list[i].sku_image,'small')}}">
					</div>
					<div class="info-wrap">
						<span class="sku-name">{{d.list[i].sku_name}}</span>
						<span class="price">价格：￥{{d.list[i].price}}</span>
						<span class="stock">库存：{{d.list[i].stock}}</span>
						<span class="sale_num">销量：{{d.list[i].sale_num}}</span>
						<!--                        <div class="prices">-->
						<!--                            价格: 原价 ￥{{d.list[i].price}}-->
						<!--                            {{# if (d.list[i].member_price_list) { }}-->
						<!--                            {{#  layui.each(d.list[i].member_price_list, function(index, item){ }}-->
						<!--                            <p class="vip_price">{{ item.level_name }} ￥{{ item.member_price }}</p>-->
						<!--                            {{#  }); }}-->
						<!--                            {{#  } }}-->
						<!--                        </div>-->
					</div>

				</li>
				{{# } }}
			</ul>
		</td>
	</tr>
</script>

<!-- 商品推广 -->
<script type="text/html" id="goods_url">
	{{# if(d.path.h5.status == 1){ }}
	<img src="{{ ns.img(d.path.h5.img) }}" alt="推广二维码">
	<p class="qrcode-item-description">扫码后直接访问商品</p>
	<a class="ns-text-color" href="javascript:ns.copy('h5_url_{{ d.goods_id }}');">复制链接</a>
	<a class="ns-text-color" href="{{ ns.img(d.path.h5.img) }}" download>下载二维码</a>
	<input class="layui-input nc-len-mid" type="text" value="{{ d.path.h5.url }}" id="h5_url_{{ d.goods_id }}" readonly>
	{{# } }}
</script>

<!-- 商品预览 -->
<script type="text/html" id="goods_preview">
	<div class="goods-preview">
		<div class="qrcode-wrap">
			<img src="{{ ns.img(d.path.h5.img) }}" alt="推广二维码">
			<p class="tips ns-text-color">手机扫码购买</p>
		</div>
		<div class="phone-wrap">
			<div class="iframe-wrap">
				<iframe src="{{ d.path.h5.url }}&preview=1" frameborder="0"></iframe>
			</div>
		</div>
	</div>
</script>

<!-- 编辑排序 -->
<script type="text/html" id="editSort">
	<input name="sort" type="number" onchange="editSort({{d.goods_id}}, this)" value="{{d.sort}}" class="layui-input edit-sort ns-sort-len">
</script>

<!-- 设置商品推荐方式 -->
<script type="text/html" id="recommend_way">
	<div class="layui-form member-form" id="reset_label" lay-filter="form">
		<div class="layui-form-item">
			<label class="layui-form-label sm">推荐方式：</label>
			<div class="layui-input-block">

				<input type="radio" name="recommend_way" value="0" title="无" checked>
				<input type="radio" name="recommend_way" value="1" title="新品">
				<input type="radio" name="recommend_way" value="2" title="精品">
				<input type="radio" name="recommend_way" value="3" title="推荐">

			</div>
		</div>

		<div class="ns-form-row sm">
			<button class="layui-btn ns-bg-color" lay-submit lay-filter="set_recommend_way">确定</button>
			<button class="layui-btn layui-btn-primary" onclick="layer.closeAll()">返回</button>
		</div>

		<input class="reset-label-id" type="hidden" name="goods_ids" value="{{d}}" />
	</div>
</script>
{/block}
{block name="script"}
<script>
	var member_price_is_exit  ="{$memberprice_is_exit}";
</script>
<script src="ADMIN_JS/goods_list.js"></script>
{/block}